package koction.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpSession;

import koction.model.seller.SellerService;
import koction.model.seller.SellerVO;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
@Controller
public class HomeController {
	@Resource(name="sellerServiceImpl")
	private SellerService sellerService;
	
	@RequestMapping("home.do")
	public String forwardHome(){
		return "home";
	}
	@RequestMapping("/consumerHome.do")
	 public String consumerHome(){
	  return "consumerHome";
	 }
	@RequestMapping("/seller.do")
	public String sellerHome(HttpSession session) throws Exception{
		SellerVO svo=(SellerVO) session.getAttribute("svo");
		int sellPrice=sellerService.findSellPrice(svo);
		session.setAttribute("sellPrice", sellPrice);
		return "sellerHome";
	}
	@RequestMapping("/sellerPrice.do")
	@ResponseBody
	public void sellerPrice(HttpSession session) throws Exception{
		SellerVO svo=(SellerVO) session.getAttribute("svo");
		int sellPrice=sellerService.findSellPrice(svo);
		session.setAttribute("sellPrice", sellPrice);
	}
}
